package com.jn.dao.code;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import com.jn.entity.code.Code;


public interface CodeDao extends PagingAndSortingRepository<Code, Long> {

	@Query("from Code c where c.type=:type order by c.order")
	public List<Code> queryByType(@Param("type") String type);

	@Query("from Code c where c.type=:type and c.value=:value")
	public List<Code> findNameByValue(@Param("type") String type,
			@Param("value") String value);

	@Query("select c from Code c where c.type=:type and c.name=:name")
	public List<Code> findValueByName(@Param("type") String type,
			@Param("name") String name);

	public Code findById(String id);

}
